package com.heima.behavior.controller;

import com.heima.behavior.service.BehaviorService;
import com.heima.model.behavior.dto.ArticleBehaviorDto;
import com.heima.model.behavior.dto.FollowBehaviorDto;
import com.heima.model.behavior.dto.LikesbehaviorDto;
import com.heima.model.behavior.dto.ReadBehaviorDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1")
public class BehaviorController {
    @Autowired
    private BehaviorService behaviorService;

    //点赞
    @PostMapping("likes_behavior")
    public ResponseResult likes_behavior(@RequestBody LikesbehaviorDto dto) {
        return behaviorService.like(dto);
    }

    //关注
    @PostMapping("follow_behavior/user_follow")
    public ResponseResult follow_behavior(@RequestBody FollowBehaviorDto dto) {
        return behaviorService.follow_behavior(dto);
    }

    //阅读
    @PostMapping("read_behavior")
    public ResponseResult readBehavior(@RequestBody ReadBehaviorDto dto) {
        return behaviorService.readBehavior(dto);
    }

    //展示
    @PostMapping("behavior/load_article_behavior")
    public ResponseResult loadArticle(@RequestBody ArticleBehaviorDto dto) {
        return behaviorService.loadArticle(dto);
    }



}
